package com.ren.service.core.rest;

import com.ren.common.result.R;
import com.ren.service.core.model.vo.UserLoginRecordRespVO;
import com.ren.service.core.service.IUserLoginRecordService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author RenGaoshuai
 * @date 2023/8/8 10:19
 * @description 用户登录日志
 */
@Api(tags = "用户登录日志")
@RestController
@RequestMapping("/api/core/loginRecord")
@Slf4j

public class UserLoginRecordController {

    @Autowired
    private IUserLoginRecordService userLoginRecordService;


    /**
     * 查询登录日志
     *
     * @return
     */
    @GetMapping("/listTop50/{userId}")
    public R listTop50(@PathVariable("userId") Long userId) {
        List<UserLoginRecordRespVO> respList = userLoginRecordService.listTop50(userId);

        return R.ok().data("list", respList);
    }


}
